/*
 * @Descripttion:
 * @version:
 * @Author: zhangzheng
 * @Date: 2020-12-04 11:31:54
 * @LastEditors: xqm 13697256625@163.com
 * @LastEditTime: 2023-12-29 21:20:14
 */
// import localStorage from 'js-cookie'

const TokenKey = 'Token'
const TokenTypeKey = 'Token-Type'
const FreshTokenKey = 'Fresh-Token'
const Userinfo = 'userinfo'
const BaseUrl = 'baseUrl'
const ConnectedBluetooth = 'connectedBluetooth'
const PrintInstruction = 'printInstruction'
const CurrentConnectedBluetoothList = 'currentConnectedBluetoothList'

const APPLICATION_TOKEN = process.env.VUE_APP_APPLICATION_TOKEN;

export function getToken () {
  return localStorage.getItem(TokenKey) || APPLICATION_TOKEN;
}

export function setToken (token) {
  return localStorage.setItem(TokenKey, token)
}

export function setTokenType (tokenType) {
  return localStorage.setItem(TokenTypeKey, tokenType)
}

export function removeTokenTypeKey () {
  return localStorage.removeItem(TokenTypeKey)
}

export function getTokenType () {
  return localStorage.getItem(TokenTypeKey) ||'Bearer'
}

export function removeToken () {
  return localStorage.removeItem(TokenKey)
}

export function setFreshToken (freshToken) {
  return localStorage.setItem(FreshTokenKey, freshToken)
}

export function getFreshToken () {
  return localStorage.getItem(FreshTokenKey)
}

export function removeFreshToken () {
  return localStorage.removeItem(FreshTokenKey)
}

export function getUserinfo () {
  return localStorage.getItem(Userinfo)
}

export function setUserinfo (userinfo) {
  return localStorage.setItem(Userinfo, userinfo)
}

export function removeUserinfo () {
  return localStorage.removeItem(Userinfo)
}

export function getBaseUrl () {
  return localStorage.getItem(BaseUrl)
}

export function setBaseUrl (baseUrl) {
  return localStorage.setItem(BaseUrl, baseUrl)
}

export function removeBaseUrl () {
  return localStorage.removeItem(BaseUrl)
}

export function getConnectedBluetooth () {
  return localStorage.getItem(ConnectedBluetooth)
}

export function setConnectedBluetooth (connectedBluetooth) {
  return localStorage.setItem(ConnectedBluetooth, connectedBluetooth)
}

export function removeConnectedBluetooth () {
  return localStorage.removeItem(ConnectedBluetooth)
}
//打印
export function setPrintInstruction(printInstruction) {
  return localStorage.setItem(PrintInstruction, printInstruction)
}

export function getPrintInstruction() {
  return localStorage.getItem(PrintInstruction)
}

export function removePrintInstruction() {
  return localStorage.removeItem(PrintInstruction)
}
export function setCurrentConnectedBluetoothList(currentConnectedBluetoothList) {
  return sessionStorage.setItem(CurrentConnectedBluetoothList, currentConnectedBluetoothList)
}

export function getCurrentConnectedBluetoothList() {
  return sessionStorage.getItem(CurrentConnectedBluetoothList)
}

export function removeCurrentConnectedBluetoothList() {
  return sessionStorage.removeItem(CurrentConnectedBluetoothList)
}